
//----------制卡部分------------------------------------------------------------------------------
//输入条件查询批量制卡请求回调函数
function getMakeCardInfo(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		$(json).each(function(n,item){
			var numPerPage=item.numPerPage;
			var currentPage=item.currentPage;
			var totalCount=item.totalCount;
			var pageCount=item.pageCount
			var list=item.list;
			var content=""
			var i;
			if(list.length!=0){
				 for(i=0;i<list.length;i++){
					 var desc;
					 var text;
					 if(list[i].desc==null){
						 desc="N"
						 text="不加急"
					 }else{
						 desc="Y"
						 text="加急"
					 }
					 var value=list[i].applyBatchNo+"#"+list[i].applyNetDot+"#"+list[i].cardPName+"#"+list[i].number+"#"+getDate(list[i].applyDate)+"#"+list[i].corp+"#"+desc;
					content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td><input name='tasking' onclick='saveByPagination(this)' value="+value+" type='checkbox'></td><td><a href='#' onclick='openDialogTasking(this)'>"+list[i].applyBatchNo+
							"</a></td><td>"+list[i].applyNetDot+"</td><td>"+list[i].cardPName+"</td><td>"+list[i].number+
							"</td><td>"+getDate(list[i].applyDate)+"</td><td>"+list[i].corp+"</td><td>"+text+"</td></tr>";
				};
			}else{
				content+="<tr><td colspan='8' align='center' >未查询到数据</td></tr>";
			}
			//alert("numPerPage,"+numPerPage+"currentPage,"+currentPage+
			//		"pageCount,"+pageCount+"totalCount,"+totalCount+"!!come in")
			$("input[name='numPerPage']").val(numPerPage);
			$("input[name='pageNum']").val(currentPage); 
//			$("input[name='pageCount']").val(pageCount);
			$("#totalCountByTasking").text("条，共"+totalCount+"条");
			$("#tbodyByTasking").html(content)
//			var pagination="<a href='#' onclick="+"previous($('#getMakeCardInfo'),getMakeCardInfo) id='previous' >上一页  </a><a href='#' onclick="+"next($('#getMakeCardInfo'),getMakeCardInfo) id='next'> 下一页</a><span>当前第"+currentPage+"页，共"+pageCount+"页</span>";
//			$("#paginationByTasking").html(pagination);
			$("#paginationByTasking").addClass("pagination").attr("targetType","navTab").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","tbodyByTasking").attr("callback","getMakeCardInfo");
			$("div.pagination").each(function(){
				var $this = $(this);
				$this.pagination({
					targetType:"navTab",
					rel:"tbodyByTasking",
					totalCount:totalCount,
					numPerPage:numPerPage,
					pageNumShown:10,
					currentPage:currentPage,
					callback:getMakeCardInfo
				});
			});
			var $p = $("#ByMakeCardBatch");
			initUI($p);
			//选中状态在分页时使用
			for(var i=0;i<list.length;i++){
				for(var j=0;j<array.length;j++){
					if(list[i].applyBatchNo==array[j].split("#")[0]){
						//alert("检查到相等了")
						//alert($("input[name='tasking']:eq("+i+")").val())
						$("input[name='tasking']:eq("+i+")").attr("checked","checked")
						test($("input[name='tasking']:eq("+i+")"))
					
					}
				}
			}
			
		});
	}	
};

//----------制卡任务导出部分 js----------------------------------------------------------------

//输入条件查询批量制卡任务回调函数
function getTaskInfo(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		$(json).each(function(n,item){
			var numPerPage=item.numPerPage;
			var currentPage=item.currentPage;
			var totalCount=item.totalCount;
			var pageCount=item.pageCount
			var list=item.list;
			var content=""
			var i; 
			//alert("numPerPage,"+numPerPage+"currentPage,"+currentPage+
			//		"pageCount,"+pageCount+"totalCount,"+totalCount+"!!come in");
			if(list.length!=0){
				 for(i=0;i<list.length;i++){
					 var desc;
					 var text;
					 if(list[i].desc=="N"){
						 desc="N"
						 text="不加急"
					 }else{
						 desc="Y"
						 text="加急"
					 }
					 var value=list[i].cardTaskNo+"#"+list[i].taskName+"#"+list[i].cardPName+"#"+list[i].cardPhysicsTypeName+"#"+list[i].cardPhysicsTypeCode+"#"+list[i].number+"#"+list[i].applyNetDot+"#"+list[i].corp+"#"+getDate(list[i].tasksGeneTime)+"#"+desc;
					content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td><input type='checkbox' onclick='saveByPagination(this)' name='tasked' class='checkboxCtrl' value="+
							  value+"></td><td><a onclick='openDialogTasked(this)'>"+list[i].cardTaskNo+
							  "</a></td><td>"+list[i].taskName+"</td><td>"+
							  list[i].cardPName+"</td><td>"+list[i].cardPhysicsTypeName+"</td><td>"+list[i].number+"</td><td>"+list[i].applyNetDot+"</td><td>"+
							  list[i].corp+"</td><td>"+getDate(list[i].tasksGeneTime)+"</td><td>"+text+"</td></tr>";
				};
			}else{
				content+="<tr><td colspan='9' align='center' >未查询到数据</td></tr>"
			}
				$("input[name='numPerPage']").val(numPerPage);
				$("input[name='pageNum']").val(currentPage); 
//				$("input[name='pageCount']").val(pageCount);
				$("#totalCountByTasked").text("条，共"+totalCount+"条");
				$("#tbodyBytasked").html(content)
//				var pagination="<a href='#' onclick="+"previous($('#getTaskInfo'),getTaskInfo) id='previous' >上一页  </a><a href='#' onclick="+"next($('#getTaskInfo'),getTaskInfo) id='next'> 下一页</a><span>当前第"+currentPage+"页，共"+pageCount+"页</span>";
//				$("#paginationByTasked").html(pagination);
				$("#paginationByTasked").addClass("pagination").attr("targetType","navTab").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","tbodyBytasked").attr("callback","getTaskInfo");
				$("div.pagination").each(function(){
				var $this = $(this);
				$this.pagination({
					targetType:"navTab",
					rel:"tbodyBytasked",
					totalCount:totalCount,
					numPerPage:numPerPage,
					pageNumShown:10,
					currentPage:currentPage,
					callback:getTaskInfo
				});
			});
				var $p = $("#ByMakeCardBatchExp");
				initUI($p);
				//选中状态在分页时使用
				for(var i=0;i<list.length;i++){
					for(var j=0;j<array.length;j++){
						if(list[i].cardTaskNo==array[j].split("#")[0]){
							//alert("检查到相等了")
							//alert($("input[name='tasked']:eq("+i+")").val())
							$("input[name='tasked']:eq("+i+")").attr("checked","checked")
							test($("input[name='tasked']:eq("+i+")"))
						
						}
					}
				}
		});
	}	
};
//----------------查询详细信息————————————————————————————————————————————
function getPeopleInfos(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		$(json).each(function(n,item){
			var numPerPage=item.numPerPage;
			var currentPage=item.currentPage;
			var totalCount=item.totalCount;
			var pageCount=item.pageCount;
			var applyBatchNo="";
			var cardTaskNo="";	
			var list=item.list;
			var content=""
			var i; 
			//alert("numPerPage,"+numPerPage+"currentPage,"+currentPage+
			//		"pageCount,"+pageCount+"totalCount,"+totalCount+"!!come in");
				 for(i=0;i<list.length;i++){
					content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td>"+list[i].customerName+"</td><td>"+list[i].paperType+"</td><td>"+list[i].paperNo+"</td><td>"+list[i].gender+"</td></tr>";
					if(i==0){
						applyBatchNo=list[i].applyBatchNo;
						cardTaskNo=list[i].cardTaskNo;
					}
				};
				$("input[name='numPerPage']").val(numPerPage);
				$("input[name='pageNum']").val(currentPage); 
//				$("input[name='pageCount']").val(pageCount);
				if(cardTaskNo!=""||cardTaskNo!=null){
					$("input[name='cardTaskNo']").val(cardTaskNo);
				}
				if(applyBatchNo!=""||applyBatchNo!=null){
					$("input[name='applyBatchNo']").val(applyBatchNo);
				}
				
				$("#totalCountByAppInfo").text("条，共"+totalCount+"条");
				$("#tbodyInfo").html(content)
//				var pagination="<a href='#' onclick='previousByTask()' id='previous' >上一页  </a><a href='#' onclick='nextByTask()' id='next'> 下一页</a><span>当前第"+currentPage+"页，共"+pageCount+"页</span>";
//				$("#paginationByAppInfo").html(pagination);
				$("#paginationByAppInfo").addClass("pagination").attr("targetType","dialog").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","tbodyInfo").attr("callback","getPeopleInfos");
				$("#paginationByAppInfo").each(function(){
					var $this = $(this);
					$this.pagination({
						targetType:"dialog",
						rel:"tbodyInfo",
						totalCount:totalCount,
						numPerPage:numPerPage,
						pageNumShown:10,
						currentPage:currentPage,
						callback:getPeopleInfos
					});
				});
				var $p = $("#ByAppInfos");
				initUI($p);
		});
	}	
};
//--------------------------不记名任务查询-------------------------------------------------------------
function getSingleTaskInfo(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		$(json).each(function(n,item){
			var numPerPage=item.numPerPage;
			var currentPage=item.currentPage;
			var totalCount=item.totalCount;
			var pageCount=item.pageCount
			var list=item.list;
			var content=""
			var i; 
			//alert("numPerPage,"+numPerPage+"currentPage,"+currentPage+
			//		"pageCount,"+pageCount+"totalCount,"+totalCount+"!!come in");
			if(list.length!=0){
				 for(i=0;i<list.length;i++){
					 var desc;
					 var text;
					 if(list[i].desc=="N"){
						 desc="N"
						 text="不加急"
					 }else{
						 desc="Y"
						 text="加急"
					 }
					 var value=list[i].cardTaskNo+"#"+list[i].taskName+"#"+list[i].cardPName+"#"+list[i].cardPhysicsTypeName+"#"+list[i].cardPhysicsTypeCode+"#"+list[i].number+"#"+list[i].corp+"#"+getDate(list[i].tasksGeneTime)+"#"+desc;
					content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td><input type='checkbox' onclick='saveByPagination(this)' name='singletasked' class='checkboxCtrl' value="+
							  value+"></td><td>"+list[i].cardTaskNo+"</td><td>"+list[i].taskName+"</td><td>"+
							  list[i].cardPName+"</td><td>"+list[i].cardPhysicsTypeName+"</td><td>"+list[i].number+"</td><td>"+getDate(list[i].tasksGeneTime)+"</td><td>"+list[i].applyNetDot+"</td><td>"+text+"</td></tr>";
				};
			}else{
				content+="<tr><td colspan='8' align='center' >未查询到数据</td></tr>"
			}
				$("input[name='numPerPage']").val(numPerPage);
				$("input[name='pageNum']").val(currentPage); 
//				$("input[name='pageCount']").val(pageCount);
				$("#totalCountBySingleTask").text("条，共"+totalCount+"条");
				$("#tbodySingleTask").html(content)
//				var pagination="<a href='#' onclick="+"previous($('#getSingleMakeCardInfo'),getSingleTaskInfo)  >上一页  </a><a href='#' onclick="+"next($('#getSingleMakeCardInfo'),getSingleTaskInfo) > 下一页</a><span>当前第"+currentPage+"页，共"+pageCount+"页</span>";
//				$("#paginationBySingleTask").html(pagination);
				$("#paginationBySingleTask").addClass("pagination").attr("targetType","navTab").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","tbodySingleTask").attr("callback","getSingleTaskInfo");
				$("div.pagination").each(function(){
				var $this = $(this);
				$this.pagination({
					targetType:"navTab",
					rel:"tbodySingleTask",
					totalCount:totalCount,
					numPerPage:numPerPage,
					pageNumShown:10,
					currentPage:currentPage,
					callback:getSingleTaskInfo
				});
			});
				var $p = $("#ByMakeCardSingle");
				initUI($p);
				//选中状态在分页时使用
				for(var i=0;i<list.length;i++){
					for(var j=0;j<array.length;j++){
						if(list[i].cardTaskNo==array[j].split("#")[0]){
							//alert("检查到相等了")
							//alert($("input[name='singletasked']:eq("+i+")").val())
							$("input[name='singletasked']:eq("+i+")").attr("checked","checked")
							test($("input[name='singletasked']:eq("+i+")"))
						
						}
					}
				}
		});
	}
	
};
//-------获取修改的信息--------------------------------------------------------------------------------
function getUpdateInfo(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		$(json).each(function(n,item){
			if(!item.sign){//修改是才执行回掉函数里面的内容
				$("input[name='taskName']").val(item.mcpv.taskName);
				$("input[name='cardTaskNo']").val(item.mcpv.cardTaskNo);
				$("input[name='count']").val(item.mcpv.count).attr("disabled","disabled");
				$("#count1").val(item.mcpv.count);
				$("#isUrgent").val(item.mcpv.isUrgent);
				var contenta="";
				var contentb="";
				var contentc="";
					contenta+="<option value="+item.mcpv.cardPCode+">"+item.mcpv.cardPName+"</option>";
					contentb+="<option value="+item.mcpv.makeCardCorpNo+">"+item.mcpv.makeCardCorpName+"</option>";
					contentc+="<option value="+item.mcpv.cardPhysicalType+">"+item.mcpv.cardPhysicalTypeName+"</option>"		
					$("#cardPCode").html(contenta);
					$("#makeCardCorpNo").html(contentb);
					$("#cardPhysicalType").html(contentc);
					$("#idByQueryTaskName").attr("hidden",true);
			}else{
				$.post("makeCardBatch/getCardCodeANDCompany",function(data){
					var contenta="<option value='' >请选择</option>";
					var contentb="<option value='' >请选择</option>";
					var contentc="<option value='' >请选择</option>";
					$(data).each(function(n,item){
						for(i=0;i<item.cdProDefinition.length;i++){
						contenta+="<option value="+item.cdProDefinition[i].cardpCode+">"
						+item.cdProDefinition[i].cardpName+"</option>"
					};
						for(i=0;i<item.companies.length;i++){
						contentb+="<option value="+item.companies[i].companyNo+">"
						+item.companies[i].companyName+"</option>"
					};
					for(i=0;i<item.cdPhysicsTypes.length;i++){
						contentc+="<option value="+item.cdPhysicsTypes[i].cardTypeCode+">"
						+item.cdPhysicsTypes[i].cardTypeName+"</option>"
					};
						$("#cardPCode").html(contenta);
						$("#makeCardCorpNo").html(contentb);
						$("#cardPhysicalType").html(contentc);
					});		
				},"json");
			}
		});
	}
	
}


